package com.dindang.checkline.mvp.presenter;

import android.app.Application;
import android.content.Intent;
import android.os.Build;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.view.View;

import com.alibaba.fastjson.JSON;
import com.dindang.checkline.R;
import com.dindang.checkline.app.utils.MyUtils;
import com.dindang.checkline.app.utils.NetworkUtils;
import com.dindang.checkline.mvp.greendao.controller.CheckItemController;
import com.dindang.checkline.mvp.greendao.controller.CheckItemDetailController;
import com.dindang.checkline.mvp.greendao.controller.CheckPiontController;
import com.dindang.checkline.mvp.greendao.entity.CheckItem;
import com.dindang.checkline.mvp.greendao.entity.CheckPiont;
import com.dindang.checkline.mvp.model.api.Api;
import com.dindang.checkline.mvp.model.entity.BaseResponse;
import com.dindang.checkline.mvp.model.entity.CheckItemEntity;
import com.dindang.checkline.mvp.model.entity.CheckLineEntity;
import com.dindang.checkline.mvp.model.entity.ItemDetailEntity;
import com.dindang.checkline.mvp.model.entity.LineEvent;
import com.dindang.checkline.mvp.model.entity.TaskDetail;
import com.dindang.checkline.mvp.model.entity.TaskEvent;
import com.dindang.checkline.mvp.ui.activity.LineDetailActivity;
import com.dindang.checkline.mvp.ui.activity.ScanActivity;
import com.dindang.checkline.mvp.ui.activity.adapter.ChecklineAdapter;
import com.dindang.checkline.mvp.ui.activity.witget.TipDialog;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import me.jessyan.rxerrorhandler.handler.RetryWithDelay;

import javax.inject.Inject;

import com.dindang.checkline.mvp.contract.ChecklineContract;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.RxLifecycleUtils;
import com.longxi.gamer_base.BaseAppConst;
import com.longxi.gamer_base.MyApplication;
import com.longxi.gamer_base.dialog.WaitDialog;
import com.longxi.gamer_base.utils.DateTimeUtils;
import com.longxi.gamer_base.utils.SharedPreferencesUtils;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 03/05/2019 13:52
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
//巡检路线，包含多个巡检点
@ActivityScope
public class ChecklinePresenter extends BasePresenter<ChecklineContract.Model, ChecklineContract.View> {
    @Inject
    RxErrorHandler mErrorHandler;
    @Inject
    Application mApplication;
    @Inject
    ImageLoader mImageLoader;
    @Inject
    AppManager mAppManager;

    private List<CheckPiont> mList = new ArrayList<>();
    private CheckLineEntity mData = new CheckLineEntity();
    private ChecklineAdapter mAdapter;
    private WaitDialog mWaitDialog;
    private CheckLineEntity.LineDetailParam mParam = new CheckLineEntity.LineDetailParam();
    private String status="0";
    private int total;//检查点宗个数
    private int haveCheck=0;//已检查过的巡检点的个数
    private String tip="我是提示框内容";//弹出框提示的内容
    private String id;//巡检路线的id
    private boolean isOrder;//是否有序
    private LineEvent mLineEvent = new LineEvent();
    private TaskEvent mTaskEvent = new TaskEvent();
    TaskDetail mDataTask = new TaskDetail();//任务单详情
    private String startTime;//计划开始时间
    private String startTimeRelly;//实际开始巡检时间
    private String durationTime;//计划巡检时长
    private int notSubmit;
    private List<ItemDetailEntity> itemDetailEntitys=new ArrayList<>();
    private CheckItemEntity checkItemEntity=new CheckItemEntity();//巡检项列表数据
    private Handler startTimehandler;
    private TimerTask runnable;
//    private Timer timer;
    private String orderTip;
    private long long1000 = 1000;
    private long time;//倒计时时间
    private long baseTimer;
    String START_CHECKTIAM = "START_CHECKTIAM";

    @Inject
    public ChecklinePresenter(ChecklineContract.Model model, ChecklineContract.View rootView) {
        super(model, rootView);
    }

    public void init() {
        mWaitDialog = new WaitDialog(mRootView.getActivity());
        EventBus.getDefault().register(this);
        if(null!=mRootView.getActivity().getIntent()){
            String str = mRootView.getActivity().getIntent().getStringExtra("data");
            mDataTask = JSON.parseObject(str,TaskDetail.class);
            isOrder =mRootView.getActivity().getIntent().getBooleanExtra("isOrder",false);;
            status = mDataTask.getRecord().getC_status();
            startTime = DateTimeUtils.dateToYearMonthDayHour(new Date(mDataTask.getPlan().getD_start()));
            durationTime =  MyUtils.getTimeDuration(new Date(mDataTask.getPlan().getD_end()),new Date(mDataTask.getPlan().getD_start()));

        }
        initAdapter();
        initListener();
        getLineDetail(null,"");
    }

    private void getLineDetail(Long piontId,String finishTime) {
        if(NetworkUtils.isAvailable(mApplication)){//有网
            getData();
        }else {
            List<CheckItem> items = CheckItemController.selectByPiontid(piontId+"");
            haveCheck=0;
            total= items.size();
            boolean isNomal=true;
            for (int i = 0; i < items.size(); i++) {
                if(items.get(i).getC_status().equals("1")||items.get(i).getC_status().equals("8")){
                    haveCheck++;//已经巡检过了
                    if(items.get(i).getC_status().equals("8")){//只要有一项巡检项异常，这个巡检点就异常
                        isNomal = false;
                    }
                }
            }
            CheckPiont piont = new CheckPiont();
            piont.setlId(piontId);
            if(haveCheck==total){
                piont.setRItemLastTime(finishTime);
                if(isNomal){
                    piont.setcStatus("3");
                }else {
                    piont.setcStatus("4");
                }
            }else {
                if(isNomal){
                    piont.setcStatus("1");
                }else {
                    piont.setcStatus("2");
                }
            }
            CheckPiontController.changeStatus(piont);
            mList.clear();
            mList.addAll(CheckPiontController.selectByLineid(mDataTask.getLine().getLId()+""));
            if(mList!=null){
                setData();
            }
        }
    }

    //获取巡检路线信息
    private void getData() {
        //以下是真实调接口
        mWaitDialog.showWaitingDialog(ArmsUtils.getString(mApplication, R.string.data_load));
        mParam.id = mDataTask.getRecord().getL_id()+"";
        mModel.quertCheckLine(mParam)
                .subscribeOn(Schedulers.io())
                .retryWhen(new RetryWithDelay(2, 2))//遇到错误时重试,第一个参数为重试几次,第二个参数为重试的间隔
                .doOnSubscribe(disposable -> {

                }).subscribeOn(AndroidSchedulers.mainThread())
                .observeOn(AndroidSchedulers.mainThread())
                .doFinally(() -> {
                    //从本地数据库获取列表
                    mList.clear();
                    mList.addAll(CheckPiontController.selectByLineid(mDataTask.getLine().getLId()+""));
                    if(mList!=null){
                        setData();
                    }
                    mWaitDialog.hideWaitingDialog();
                })
                .compose(RxLifecycleUtils.bindToLifecycle(mRootView))//使用 Rxlifecycle,使 Disposable 和 Activity 一起销毁
                .subscribe(new ErrorHandleSubscriber<BaseResponse<CheckLineEntity>>(mErrorHandler) {
                    @Override
                    public void onError(Throwable t) {
                        super.onError(t);
                        ArmsUtils.makeText(mRootView.getActivity(),t.getMessage());
                    }

                    @Override
                    public void onNext(BaseResponse<CheckLineEntity> response) {
                        if(response.getStatus().equals(BaseAppConst.OUT_TOKEN)){
                            MyApplication.getInstance().gotoLoginActivity();
                        }
                        mData = response.getData();
                        //数据插入本地数据库
                        CheckPiontController.deleteAllPiont(mDataTask.getLine().getLId()+"");//插入前先删除
                        CheckItemController.deleteAllItem(mDataTask.getLine().getLId()+"");
                        for (int i = 0; i < mData.getRows().size(); i++) {
                           Long l =  CheckPiontController.insertPiont(mData.getRows().get(i),mDataTask.getLine().getLId());
                           if(l>0){
                               List<CheckItem> itemList = mData.getRows().get(i).getInfo();
                               if(itemList!=null){
                                   for (int j = 0; j <itemList.size(); j++) {
                                       CheckItemController.insertItem(itemList.get(j),mDataTask.getLine().getLId(),mData.getRows().get(i).getlId());
                                   }
                               }
                           }
                        }
                    }
                });
    }

    private void setData() {
        setUpdataNum();
        total = mList.size();
        haveCheck = 0;
        for (int i = 0; i < mList.size(); i++) {
            if(mList.get(i).getcStatus().equals("3")||mList.get(i).getcStatus().equals("4")){
                haveCheck++;
            }
        }
        if(total==haveCheck){//巡检完成
            status = "4";
            mDataTask.getRecord().setC_status("4");
        }
//        String[] states = {"", "等待接单", "等待开始", "正在巡检", "正常结束", "异常结束", "逾期终止", "逾期未巡", "逾期结束"};
        if(status.equals("2")&&(DateTimeUtils.dateToTimestamp(startTime+"")>System.currentTimeMillis())){//还不能开始巡检
            mRootView.getButtonGoCheck().setClickable(true);
            mRootView.getButtonGoCheck().setBackground(null);
            setCountDown();//设置距离开始倒计时
        }else if(status.equals("2")&&(DateTimeUtils.dateToTimestamp(startTime+"")<=System.currentTimeMillis())){//可以开始巡检了，但还没开始巡检
            mRootView.getButtonGoCheck().setClickable(true);
            mRootView.getButtonGoCheck().setTextColor(mRootView.getActivity().getResources().getColor(R.color.maintenance_color_blue));
            mRootView.getButtonGoCheck().setText("开始巡检");
            mRootView.getButtonGoCheck().setBackgroundResource(R.drawable.maintenance_bg_radio_2_border_gary);
        }else if(status.equals("4")){//巡检已完成
            mRootView.getButtonGoCheck().setClickable(true);
            mRootView.getButtonGoCheck().setTextColor(mRootView.getActivity().getResources().getColor(R.color.maintenance_color_blue));
            mRootView.getButtonGoCheck().setText("本次巡检结束,点击查看详情");
            mRootView.getButtonGoCheck().setBackground(null);
            if(null!=timer){
                timer.cancel();
            }
        }else{
            mRootView.getButtonGoCheck().setClickable(false);
            mRootView.getButtonGoCheck().setBackground(null);
            setTime();//设置已巡检时长计时器
        }
        if(isOrder){
            mRootView.gettip().setVisibility(View.VISIBLE);
        }else {
            mRootView.gettip().setVisibility(View.GONE);
        }
        boolean isStart = true;
        if(mDataTask.getRecord().getC_status().equals("2")){
            isStart = false;
        }
        mAdapter.setIsOrder(isOrder,isStart);
        mAdapter.notifyDataSetChanged();
    }

    private void setUpdataNum() {
        itemDetailEntitys = CheckItemDetailController.selectNotSubmit();
        notSubmit = itemDetailEntitys.size();
        mRootView.gettvUpdataeNum().setText(notSubmit+"");
    }
    private void setTime() {
//        long baseTimer = SystemClock.elapsedRealtime();
        if(startTimeRelly==null||startTimeRelly.isEmpty()){
           baseTimer = DateTimeUtils.dateToTimestamp(""+DateTimeUtils.dateToYearMonthDayHour(new Date(mDataTask.getRecord().getD_execute())));
        }else {
           baseTimer = DateTimeUtils.dateToTimestamp(startTimeRelly);
        }

        startTimehandler = new Handler(){
            public void handleMessage(android.os.Message msg) {
                if (mRootView!=null&&null != mRootView.getButtonGoCheck()) {
                    mRootView.getButtonGoCheck().setTextColor(mRootView.getActivity().getResources().getColor(R.color.tv_color18));
                    mRootView.getButtonGoCheck().setTextSize(16);
                    mRootView.getButtonGoCheck().setText("已巡检时长"+msg.obj+",计划巡检时长"+durationTime+",您还剩"+(total-haveCheck)+"个巡检点未检查");
                }
            }
        };
        runnable =new TimerTask() {
            @Override
            public void run() {
                int time = (int)((System.currentTimeMillis() - baseTimer) / 1000);
                String hh = new DecimalFormat("00").format(time / 3600);
                String mm = new DecimalFormat("00").format(time % 3600 / 60);
                String ss = new DecimalFormat("00").format(time % 60);
                String timeFormat = new String(hh + ":" + mm + ":" + ss);
                Message msg = new Message();
                msg.obj = timeFormat;
                startTimehandler.sendMessage(msg);
            }
        };
        timer = new Timer("开机计时器");
        timer.scheduleAtFixedRate(runnable, 0, 1000L);
    }



    //设置倒计时
    private void setCountDown() {
        time = (DateTimeUtils.dateToTimestamp(startTime+"")-System.currentTimeMillis())/long1000;
        //执行计时任务
        timer.schedule(new MyTimerTask(), 1000, 1000);

//        CountDownTimer timer = new CountDownTimer(time, 1000) {
//            @Override
//            public void onTick(long millisUntilFinished) {
//                mRootView.getButtonGoCheck().setText("距离开始时间还有"+formatTime(millisUntilFinished));
//            }
//
//            @Override
//            public void onFinish() {
//                mRootView.getButtonGoCheck().setText("开始巡检");
//            }
//        };
    }

    //定义TimerTask
    private class MyTimerTask extends TimerTask{
        @Override
        public void run() {
            Message message = handler.obtainMessage(0);
            message.sendToTarget();
        }
    }



        //创建Timer计时器
    Timer timer = new Timer();
    private Handler handler = new Handler(){
        public void handleMessage(android.os.Message msg) {
            if(msg.what==0){
                if(time==-1){
                    mRootView.getButtonGoCheck().setClickable(true);
                    mRootView.getButtonGoCheck().setTextColor(mRootView.getActivity().getResources().getColor(R.color.maintenance_color_blue));
                    mRootView.getButtonGoCheck().setText("开始巡检");
                    mRootView.getButtonGoCheck().setBackgroundResource(R.drawable.maintenance_bg_radio_2_border_gary);
                    timer.cancel();
                    return;
                }
                mRootView.getButtonGoCheck().setTextColor(mRootView.getActivity().getResources().getColor(R.color.tv_color18));
                mRootView.getButtonGoCheck().setText("距离开始时间还有"+formatTime(time--));
                mRootView.getButtonGoCheck().setBackground(null);
            }

        };
    };

    private static long getIntTime(String time) {
        SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
        Date date = null;
        Date sDate = null;
        try { date = format.parse(time);sDate = format.parse("00:00:00"); }
        catch (ParseException e)
        { e.printStackTrace(); }
        return (date.getTime()-sDate.getTime())/1000;}

    /**
     * 将毫秒转化为 分钟：秒 的格式
     *
     * @param millisecond 毫秒
     * @return
     */
    public String formatTime(long millisecond) {
        int minute;//分钟
        int second;//秒数
        minute = (int) ((millisecond) / 60);
        second = (int) ((millisecond) % 60);
        if (minute < 10) {
            if (second < 10) {
                return "0" + minute + ":" + "0" + second;
            } else {
                return "0" + minute + ":" + second;
            }
        }else {
            if (second < 10) {
                return minute + ":" + "0" + second;
            } else {
                return minute + ":" + second;
            }
        }
    }

    /**
     * 初始化适配器
     */
    private void initAdapter() {
        mAdapter = new ChecklineAdapter(mList);
        mRootView.getRecyclerView().setAdapter(mAdapter);
    }

    @Subscribe(threadMode = ThreadMode.POSTING)
    public void MaintainDetailsRefresh(LineEvent lineEvent){
        getLineDetail(lineEvent.getPiontId(),lineEvent.getFinishTime());
    }

    private void initListener() {
        //点击需要上传的缓存巡检项
        mRootView.getRlupddate().setOnClickListener(v -> goUp());
        //点击开始巡检按钮，弹出提示框
        mRootView.getButtonGoCheck().setOnClickListener(v -> goStart());
        //点击扫描二维码
        mAdapter.setMyOnClickListener(new ChecklineAdapter.MyOnClickListener() {
            @Override
            public void onScanClick(int position) {
               if(isOrder&&position!=0&&mList.get(position-1).getCStatus().equals("0")){//判断是否是有序的
                   ArmsUtils.makeText(mRootView.getActivity(),"请按顺序巡检");
                   return;
                }
                if(mList.get(position).getCStatus().equals("3")||mList.get(position).getCStatus().equals("4")){//判断是否是有序的
                    ArmsUtils.makeText(mRootView.getActivity(),"该巡检点已巡检结束");
                    return;
                }
               //跳转到扫面页面
                    Intent intent = new Intent(mRootView.getActivity(), ScanActivity.class);
                    intent.putExtra("data",JSON.toJSONString(mList.get(position)));
                    mRootView.getActivity().startActivity(intent);
            }
        });
    }

    private void goUp() {
        if(!SharedPreferencesUtils.getParam(mRootView.getActivity(),START_CHECKTIAM+ BaseAppConst.accountInfo.getUserId(),"").equals("")){
            submitStart(true);
        }else {
            if(mRootView.gettvUpdataeNum().getText().toString().equals("0")){
                ArmsUtils.makeText(mRootView.getActivity(),"没有需要上传的数据");
            }else {//开始上传
                postData();
            }
        }
    }

    private void goStart() {
        if(status.equals("4")){//巡检完成查看详情
            Intent intent = new Intent(mRootView.getActivity(), LineDetailActivity.class);
            intent.putExtra("data", JSON.toJSONString(mDataTask));
            mRootView.getActivity().startActivity(intent);
        }else if(status.equals("2")){
            if(DateTimeUtils.dateToTimestamp(startTime+"")>System.currentTimeMillis()){//还不能开始巡检
                return;
            }
            startTimeRelly = DateTimeUtils.dateToYearMonthDayHour(new Date(System.currentTimeMillis()));
            if (NetworkUtils.isAvailable(mApplication)) {
                submitStart(false);
            }else {
                //把巡检开始时间插入到本地
                SharedPreferencesUtils.setParam(mApplication,START_CHECKTIAM+ BaseAppConst.accountInfo.getUserId(),mDataTask.getRecord().getL_id()+","+startTimeRelly);
                showDialog();
                status = "3";
                mDataTask.getRecord().setC_status("3");
                setData();
            }
        }
    }

    private void postData() {//点击提交缓存数据
        //以下是真实调接口
        for (int i = 0; i < itemDetailEntitys.size(); i++) {
            mWaitDialog.showWaitingDialog(ArmsUtils.getString(mApplication, R.string.data_load));
            int finalI = i;
            mModel.submitItemDetail(itemDetailEntitys.get(i))
                    .subscribeOn(Schedulers.io())
                    .retryWhen(new RetryWithDelay(2, 2))//遇到错误时重试,第一个参数为重试几次,第二个参数为重试的间隔
                    .doOnSubscribe(disposable -> {

                    }).subscribeOn(AndroidSchedulers.mainThread())
                    .observeOn(AndroidSchedulers.mainThread())
                    .doFinally(() -> {
                        mWaitDialog.hideWaitingDialog();
                    })
                    .compose(RxLifecycleUtils.bindToLifecycle(mRootView))//使用 Rxlifecycle,使 Disposable 和 Activity 一起销毁
                    .subscribe(new ErrorHandleSubscriber<BaseResponse>(mErrorHandler) {
                        @Override
                        public void onNext(BaseResponse response) {
                            if(response.getStatus().equals(BaseAppConst.OUT_TOKEN)){
                                MyApplication.getInstance().gotoLoginActivity();
                            }
                            if(response.isSuccess()){
                                mRootView.gettvUpdataeNum().setText(notSubmit--+"");
                                CheckItemDetailController.deleteByid(itemDetailEntitys.get(finalI));
                                EventBus.getDefault().post(mLineEvent);
                            }
                        }

                        @Override
                        public void onError(Throwable t) {
                            super.onError(t);
                        }
                    });
        }
    }


    private void submitStart(boolean updata) {
        //点击开始巡检
        CheckLineEntity.ChangeStatus paramStatus = new CheckLineEntity.ChangeStatus();
        paramStatus.id = mDataTask.getRecord().getL_id()+"";
        paramStatus.dExecute = startTimeRelly;
        mModel.submitStart(paramStatus)
                .subscribeOn(Schedulers.io())
                .retryWhen(new RetryWithDelay(2, 2))//遇到错误时重试,第一个参数为重试几次,第二个参数为重试的间隔
                .doOnSubscribe(disposable -> {

                }).subscribeOn(AndroidSchedulers.mainThread())
                .observeOn(AndroidSchedulers.mainThread())
                .doFinally(() -> {
                })
                .compose(RxLifecycleUtils.bindToLifecycle(mRootView))//使用 Rxlifecycle,使 Disposable 和 Activity 一起销毁
                .subscribe(new ErrorHandleSubscriber<BaseResponse>(mErrorHandler) {
                    @Override
                    public void onError(Throwable t) {
                        super.onError(t);
                    }

                    @Override
                    public void onNext(BaseResponse response) {
                        if(response.getStatus().equals(BaseAppConst.OUT_TOKEN)){
                            MyApplication.getInstance().gotoLoginActivity();
                        }
                        if(response.isSuccess()){
                            if(updata){//提交完开始巡检的时间，再提交缓存的数据
                                if(mRootView.gettvUpdataeNum().getText().toString().equals("0")){
                                    ArmsUtils.makeText(mRootView.getActivity(),"没有需要上传的数据");
                                }else {//开始上传
                                    postData();
                                }
                            }else {
                                EventBus.getDefault().post(mTaskEvent);
                                mDataTask.getRecord().setC_status("3");
                                status = "3";
                                mDataTask.getRecord().setD_execute(startTimeRelly);
                                setData();
                                showDialog();
                            }
                        }
                    }
                });
    }

    TipDialog.Builder mDialog;
        private void showDialog(){
            tip = mDataTask.getPlan().getC_officer()+"，您好\n   您已与"+startTimeRelly
                    +"开始巡检，请您再接下来的巡检中注意安全，同时按照规定的标准和要求完成本次巡检任务。\n  本次巡检的基本情况请您知晓：\n" +
                    "  1,巡检方式：对准二维码，使用扫一扫\n"
                    +"  2,巡检点数："+mList.size()+"\n"
                    +"  3,巡检时长："+durationTime+"\n"
                    +"  4,截止时间："+DateTimeUtils.dateToYearMonthDayHour(new Date(mDataTask.getPlan().getD_end()))+"\n";
            if(mDialog != null){
                mDialog.show();
            }else{
                mDialog = new TipDialog.Builder(mRootView.getActivity());
                mDialog.setTip(tip)
                        .setProperty(new TipDialog.OnPaymentListener() {
                            @Override
                            public void onClick(String paytype) {
                                mDialog.dismiss();
                            }
                        })
                        .create()
                        .show();
            }
    }


    @Override
    public void onDestroy() {
        super.onDestroy();
        if(null!=timer){
            timer.cancel();
        }
        this.mErrorHandler = null;
        this.mAppManager = null;
        this.mImageLoader = null;
        this.mApplication = null;

        this.mList = null;
        this.mData = null;
        this.mAdapter = null;
        this.mWaitDialog = null;
        this.mParam = null;
        this.mLineEvent = null;
        this.mTaskEvent = null;
        this.mDataTask = null;
        this.startTime = null;
        this.itemDetailEntitys = null;
        this.checkItemEntity = null;
    }
}
